<?php
include '../../templates/db/db.php';

// proverka za poleto s DB
    $user = $_POST['username'];
    $sql_sql = 'SELECT username FROM users WHERE username="'.$user.'"';
    $results_sql = mysql_query($sql_sql);
    $broi = mysql_num_rows($results_sql);
	
    if(strlen($user) < 3) {
        echo "<img src='../img/close.png' width='15px' style='margin-left: 10px;' />";
		echo "<p class='error'>Кратко име!</p>";
		$error_username = true;
    } else if($broi != 0){
	   echo "<img src='../img/close.png' width='15px' style='margin-left: 10px;' />";
	   echo "<p class='error'>Потребителското име е вече заето!</p>";
	   $error_username = true;
	} 
	
	else {
        echo "<img src='../img/check.png' width='15px' style='margin-left: 10px;' />";
    }
?>